<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Haml::Buffer</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Haml::Buffer</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/vendor/plugins/haml/lib/haml/buffer_rb.html">
                vendor/plugins/haml/lib/haml/buffer.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
This class is used only internally. It holds the buffer of XHTML that is
eventually output by <a href="Engine.html">Haml::Engine</a>&#8216;s to_html
method. It&#8216;s called from within the precompiled code, and helps
reduce the amount of processing done within instance_eval&#8216;d code.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000032">build_attributes</a>&nbsp;&nbsp;
      <a href="#M000031">close_comment</a>&nbsp;&nbsp;
      <a href="#M000029">close_tag</a>&nbsp;&nbsp;
      <a href="#M000028">merge_attrs</a>&nbsp;&nbsp;
      <a href="#M000023">new</a>&nbsp;&nbsp;
      <a href="#M000033">one_liner?</a>&nbsp;&nbsp;
      <a href="#M000030">open_comment</a>&nbsp;&nbsp;
      <a href="#M000026">open_prerendered_tag</a>&nbsp;&nbsp;
      <a href="#M000027">open_tag</a>&nbsp;&nbsp;
      <a href="#M000025">push_script</a>&nbsp;&nbsp;
      <a href="#M000024">push_text</a>&nbsp;&nbsp;
      <a href="#M000021">tabulation</a>&nbsp;&nbsp;
      <a href="#M000022">tabulation=</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="Helpers.html">Haml::Helpers</a></span>
      </div>
    </div>

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ONE_LINER_LENGTH</td>
          <td>=</td>
          <td class="context-item-value">50</td>
          <td width="3em">&nbsp;</td>
          <td class="context-item-desc">
Set the maximum length for a line to be considered a one-liner. Lines &lt;=
the maximum will be rendered on one line, i.e. <tt>&lt;p&gt;Hello
world&lt;/p&gt;</tt>

</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">buffer</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
The string that holds the compiled XHTML. This is aliased as _erbout for
compatibility with ERB-specific code.

</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000028" class="method-detail">
        <a name="M000028"></a>

        <div class="method-heading">
          <a href="#M000028" class="method-signature">
          <span class="method-name">merge_attrs</span><span class="method-args">(to, from)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000028-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 104</span>
104:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">merge_attrs</span>(<span class="ruby-identifier">to</span>, <span class="ruby-identifier">from</span>)
105:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'id'</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">from</span>[<span class="ruby-value str">'id'</span>]
106:         <span class="ruby-identifier">to</span>[<span class="ruby-value str">'id'</span>] <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">'_'</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">from</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'id'</span>)
107:       <span class="ruby-keyword kw">end</span>
108: 
109:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'class'</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">from</span>[<span class="ruby-value str">'class'</span>]
110:         <span class="ruby-comment cmt"># Make sure we don't duplicate class names</span>
111:         <span class="ruby-identifier">from</span>[<span class="ruby-value str">'class'</span>] = (<span class="ruby-identifier">from</span>[<span class="ruby-value str">'class'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>) <span class="ruby-operator">|</span> <span class="ruby-identifier">to</span>[<span class="ruby-value str">'class'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">' '</span>)).<span class="ruby-identifier">join</span>(<span class="ruby-value str">' '</span>)
112:       <span class="ruby-keyword kw">end</span>
113: 
114:       <span class="ruby-identifier">to</span>.<span class="ruby-identifier">merge!</span>(<span class="ruby-identifier">from</span>)
115:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a <a href="Buffer.html#M000023">new</a> buffer.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 30</span>
30:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
31:       <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
32:       <span class="ruby-ivar">@quote_escape</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:attr_wrapper</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;&amp;quot;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;&amp;apos;&quot;</span>
33:       <span class="ruby-ivar">@other_quote_char</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:attr_wrapper</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'&quot;'</span> <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;'&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">'&quot;'</span>
34:       <span class="ruby-ivar">@buffer</span> = <span class="ruby-value str">&quot;&quot;</span>
35:       <span class="ruby-ivar">@one_liner_pending</span> = <span class="ruby-keyword kw">false</span>
36:       <span class="ruby-ivar">@tabulation</span> = <span class="ruby-value">0</span>
37: 
38:       <span class="ruby-comment cmt"># The number of tabs that Engine thinks we should have</span>
39:       <span class="ruby-comment cmt"># @real_tabs + @tabulation is the number of tabs actually output</span>
40:       <span class="ruby-ivar">@real_tabs</span> = <span class="ruby-value">0</span>
41:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000033" class="method-detail">
        <a name="M000033"></a>

        <div class="method-heading">
          <a href="#M000033" class="method-signature">
          <span class="method-name">one_liner?</span><span class="method-args">(value)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns whether or not the given value is short enough to be rendered on
one line.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000033-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 175</span>
175:     <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">one_liner?</span>(<span class="ruby-identifier">value</span>)
176:       <span class="ruby-identifier">value</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-constant">ONE_LINER_LENGTH</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">scan</span>(<span class="ruby-regexp re">/\n/</span>).<span class="ruby-identifier">empty?</span>
177:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000032" class="method-detail">
        <a name="M000032"></a>

        <div class="method-heading">
          <a href="#M000032" class="method-signature">
          <span class="method-name">build_attributes</span><span class="method-args">(attributes = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Takes a hash and builds a list of XHTML attributes from it, returning the
result.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000032-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 155</span>
155:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_attributes</span>(<span class="ruby-identifier">attributes</span> = {})
156:       <span class="ruby-identifier">result</span> = <span class="ruby-identifier">attributes</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">a</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
157:         <span class="ruby-identifier">v</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">to_s</span>
158:         <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">empty?</span>
159:           <span class="ruby-identifier">attr_wrapper</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-identifier">:attr_wrapper</span>]
160:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">attr_wrapper</span>
161:             <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">include?</span> <span class="ruby-ivar">@other_quote_char</span>
162:               <span class="ruby-identifier">v</span> = <span class="ruby-identifier">v</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-identifier">attr_wrapper</span>, <span class="ruby-ivar">@quote_escape</span>)
163:             <span class="ruby-keyword kw">else</span>
164:               <span class="ruby-identifier">attr_wrapper</span> = <span class="ruby-ivar">@other_quote_char</span>
165:             <span class="ruby-keyword kw">end</span>
166:           <span class="ruby-keyword kw">end</span>
167:           <span class="ruby-node">&quot; #{a}=#{attr_wrapper}#{v}#{attr_wrapper}&quot;</span>
168:         <span class="ruby-keyword kw">end</span>
169:       <span class="ruby-keyword kw">end</span>
170:       <span class="ruby-identifier">result</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">join</span>
171:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000031" class="method-detail">
        <a name="M000031"></a>

        <div class="method-heading">
          <a href="#M000031" class="method-signature">
          <span class="method-name">close_comment</span><span class="method-args">(has_conditional, tabulation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Closes an XHTML comment.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000031-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 140</span>
140:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close_comment</span>(<span class="ruby-identifier">has_conditional</span>, <span class="ruby-identifier">tabulation</span>)
141:       <span class="ruby-identifier">close_tag</span> = <span class="ruby-identifier">has_conditional</span> <span class="ruby-value">? </span><span class="ruby-value str">&quot;&lt;![endif]--&gt;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;--&gt;&quot;</span>
142:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@one_liner_pending</span>
143:         <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot; #{close_tag}\n&quot;</span>
144:         <span class="ruby-ivar">@one_liner_pending</span> = <span class="ruby-keyword kw">false</span>
145:       <span class="ruby-keyword kw">else</span>
146:         <span class="ruby-identifier">push_text</span>(<span class="ruby-identifier">close_tag</span>, <span class="ruby-identifier">tabulation</span>)
147:       <span class="ruby-keyword kw">end</span>
148:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000029" class="method-detail">
        <a name="M000029"></a>

        <div class="method-heading">
          <a href="#M000029" class="method-signature">
          <span class="method-name">close_tag</span><span class="method-args">(name, tabulation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a closing tag with the given name.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000029-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 118</span>
118:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close_tag</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">tabulation</span>)
119:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@one_liner_pending</span>
120:         <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;&lt;/#{name}&gt;\n&quot;</span>
121:         <span class="ruby-ivar">@one_liner_pending</span> = <span class="ruby-keyword kw">false</span>
122:       <span class="ruby-keyword kw">else</span>
123:         <span class="ruby-identifier">push_text</span>(<span class="ruby-node">&quot;&lt;/#{name}&gt;&quot;</span>, <span class="ruby-identifier">tabulation</span>)
124:       <span class="ruby-keyword kw">end</span>
125:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000030" class="method-detail">
        <a name="M000030"></a>

        <div class="method-heading">
          <a href="#M000030" class="method-signature">
          <span class="method-name">open_comment</span><span class="method-args">(try_one_line, conditional, tabulation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Opens an XHTML comment.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000030-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 128</span>
128:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open_comment</span>(<span class="ruby-identifier">try_one_line</span>, <span class="ruby-identifier">conditional</span>, <span class="ruby-identifier">tabulation</span>)
129:       <span class="ruby-identifier">conditional</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;&gt;&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">conditional</span>
130:       <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{tabs(tabulation)}&lt;!--#{conditional.to_s} &quot;</span>
131:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">try_one_line</span>
132:         <span class="ruby-ivar">@one_liner_pending</span> = <span class="ruby-keyword kw">true</span>
133:       <span class="ruby-keyword kw">else</span>
134:         <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span>
135:         <span class="ruby-ivar">@real_tabs</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
136:       <span class="ruby-keyword kw">end</span>
137:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="#M000026" class="method-signature">
          <span class="method-name">open_prerendered_tag</span><span class="method-args">(tag, tabulation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000026-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 76</span>
76:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open_prerendered_tag</span>(<span class="ruby-identifier">tag</span>, <span class="ruby-identifier">tabulation</span>)
77:       <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{tabs(tabulation)}#{tag}&quot;</span>
78:       <span class="ruby-ivar">@real_tabs</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
79:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">open_tag</span><span class="method-args">(name, tabulation, atomic, try_one_line, class_id, obj_ref, attributes_hash)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Takes the various information about the opening tag for an element, formats
it, and adds it to the buffer.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 83</span>
 83:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">open_tag</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">tabulation</span>, <span class="ruby-identifier">atomic</span>, <span class="ruby-identifier">try_one_line</span>, <span class="ruby-identifier">class_id</span>, <span class="ruby-identifier">obj_ref</span>, <span class="ruby-identifier">attributes_hash</span>)
 84:       <span class="ruby-identifier">attributes</span> = <span class="ruby-identifier">class_id</span>
 85:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">attributes_hash</span>
 86:         <span class="ruby-identifier">attributes_hash</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span> <span class="ruby-identifier">attributes_hash</span>[<span class="ruby-identifier">key</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">attributes_hash</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>) }
 87:         <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">merge_attrs</span>(<span class="ruby-identifier">attributes</span>, <span class="ruby-identifier">attributes_hash</span>)
 88:       <span class="ruby-keyword kw">end</span>
 89:       <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">merge_attrs</span>(<span class="ruby-identifier">attributes</span>, <span class="ruby-identifier">parse_object_ref</span>(<span class="ruby-identifier">obj_ref</span>)) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">obj_ref</span>
 90: 
 91:       <span class="ruby-ivar">@one_liner_pending</span> = <span class="ruby-keyword kw">false</span>
 92:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">atomic</span>
 93:         <span class="ruby-identifier">str</span> = <span class="ruby-value str">&quot; /&gt;\n&quot;</span>
 94:       <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">try_one_line</span>
 95:         <span class="ruby-ivar">@one_liner_pending</span> = <span class="ruby-keyword kw">true</span>
 96:         <span class="ruby-identifier">str</span> = <span class="ruby-value str">&quot;&gt;&quot;</span>
 97:       <span class="ruby-keyword kw">else</span>
 98:         <span class="ruby-identifier">str</span> = <span class="ruby-value str">&quot;&gt;\n&quot;</span>
 99:       <span class="ruby-keyword kw">end</span>
100:       <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{tabs(tabulation)}&lt;#{name}#{build_attributes(attributes)}#{str}&quot;</span>
101:       <span class="ruby-ivar">@real_tabs</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
102:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="#M000025" class="method-signature">
          <span class="method-name">push_script</span><span class="method-args">(result, tabulation, flattened)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Properly formats the output of a script that was run in the instance_eval.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000025-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 59</span>
59:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push_script</span>(<span class="ruby-identifier">result</span>, <span class="ruby-identifier">tabulation</span>, <span class="ruby-identifier">flattened</span>)
60:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">flattened</span>
61:         <span class="ruby-identifier">result</span> = <span class="ruby-constant">Haml</span><span class="ruby-operator">::</span><span class="ruby-constant">Helpers</span>.<span class="ruby-identifier">find_and_preserve</span>(<span class="ruby-identifier">result</span>)
62:       <span class="ruby-keyword kw">end</span>
63: 
64:       <span class="ruby-identifier">result</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">to_s</span>
65:       <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">result</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">10</span> <span class="ruby-comment cmt"># \n</span>
66:         <span class="ruby-comment cmt"># String#chomp is slow</span>
67:         <span class="ruby-identifier">result</span> = <span class="ruby-identifier">result</span>[<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-value">-1</span>]
68:       <span class="ruby-keyword kw">end</span>
69:       
70:       <span class="ruby-identifier">result</span> = <span class="ruby-identifier">result</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">&quot;\n&quot;</span>, <span class="ruby-node">&quot;\n#{tabs(tabulation)}&quot;</span>)
71:       <span class="ruby-identifier">push_text</span> <span class="ruby-identifier">result</span>, <span class="ruby-identifier">tabulation</span>
72:       <span class="ruby-keyword kw">nil</span>
73:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="#M000024" class="method-signature">
          <span class="method-name">push_text</span><span class="method-args">(text, tabulation)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Renders <tt>text</tt> with the proper <a
href="Buffer.html#M000021">tabulation</a>. This also deals with making a
possible one-line tag one line or not.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000024-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 45</span>
45:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push_text</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">tabulation</span>)
46:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@one_liner_pending</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Buffer</span>.<span class="ruby-identifier">one_liner?</span>(<span class="ruby-identifier">text</span>)
47:         <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">text</span>
48:       <span class="ruby-keyword kw">else</span>
49:         <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@one_liner_pending</span>
50:           <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;\n&quot;</span>
51:           <span class="ruby-ivar">@one_liner_pending</span> = <span class="ruby-keyword kw">false</span>
52:         <span class="ruby-keyword kw">end</span>
53:         <span class="ruby-ivar">@buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{tabs(tabulation)}#{text}\n&quot;</span>
54:       <span class="ruby-keyword kw">end</span>
55:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000021" class="method-detail">
        <a name="M000021"></a>

        <div class="method-heading">
          <a href="#M000021" class="method-signature">
          <span class="method-name">tabulation</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Gets the current <a href="Buffer.html#M000021">tabulation</a> of the
document.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000021-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000021-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 19</span>
19:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabulation</span>
20:       <span class="ruby-ivar">@real_tabs</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@tabulation</span>
21:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">tabulation=</span><span class="method-args">(val)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Sets the current <a href="Buffer.html#M000021">tabulation</a> of the
document.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/haml/lib/haml/buffer.rb, line 24</span>
24:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tabulation=</span>(<span class="ruby-identifier">val</span>)
25:       <span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@real_tabs</span>
26:       <span class="ruby-ivar">@tabulation</span> = <span class="ruby-identifier">val</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">val</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
27:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>